{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ECUBoost-RF</th>\n",
       "      <th>Unnamed: 1</th>\n",
       "      <th>CUBoost-RF</th>\n",
       "      <th>Unnamed: 3</th>\n",
       "      <th>RUSBagging-RF</th>\n",
       "      <th>Unnamed: 5</th>\n",
       "      <th>RUSBoost-RF</th>\n",
       "      <th>Unnamed: 7</th>\n",
       "      <th>USBC-RF</th>\n",
       "      <th>Unnamed: 9</th>\n",
       "      <th>SMOTE-RF</th>\n",
       "      <th>Unnamed: 11</th>\n",
       "      <th>EasyEnsemble-RF</th>\n",
       "      <th>Unnamed: 13</th>\n",
       "      <th>XGBoost</th>\n",
       "      <th>Unnamed: 15</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.993103</td>\n",
       "      <td>0.009478</td>\n",
       "      <td>0.989425</td>\n",
       "      <td>0.014841</td>\n",
       "      <td>0.991724</td>\n",
       "      <td>0.011789</td>\n",
       "      <td>0.989425</td>\n",
       "      <td>0.015039</td>\n",
       "      <td>0.985977</td>\n",
       "      <td>0.021724</td>\n",
       "      <td>0.994483</td>\n",
       "      <td>0.007728</td>\n",
       "      <td>0.987816</td>\n",
       "      <td>0.021405</td>\n",
       "      <td>0.9956</td>\n",
       "      <td>0.006663</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.908439</td>\n",
       "      <td>0.044449</td>\n",
       "      <td>0.894431</td>\n",
       "      <td>0.050967</td>\n",
       "      <td>0.886852</td>\n",
       "      <td>0.062806</td>\n",
       "      <td>0.891847</td>\n",
       "      <td>0.058767</td>\n",
       "      <td>0.897006</td>\n",
       "      <td>0.039160</td>\n",
       "      <td>0.913929</td>\n",
       "      <td>0.044064</td>\n",
       "      <td>0.902778</td>\n",
       "      <td>0.036237</td>\n",
       "      <td>0.8991</td>\n",
       "      <td>0.028219</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.993238</td>\n",
       "      <td>0.003612</td>\n",
       "      <td>0.992228</td>\n",
       "      <td>0.004179</td>\n",
       "      <td>0.992723</td>\n",
       "      <td>0.004000</td>\n",
       "      <td>0.993123</td>\n",
       "      <td>0.004163</td>\n",
       "      <td>0.989549</td>\n",
       "      <td>0.005546</td>\n",
       "      <td>0.992334</td>\n",
       "      <td>0.003973</td>\n",
       "      <td>0.991793</td>\n",
       "      <td>0.006411</td>\n",
       "      <td>0.9936</td>\n",
       "      <td>0.003381</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.833268</td>\n",
       "      <td>0.018645</td>\n",
       "      <td>0.821572</td>\n",
       "      <td>0.025394</td>\n",
       "      <td>0.830368</td>\n",
       "      <td>0.017240</td>\n",
       "      <td>0.828618</td>\n",
       "      <td>0.015945</td>\n",
       "      <td>0.831016</td>\n",
       "      <td>0.027691</td>\n",
       "      <td>0.823170</td>\n",
       "      <td>0.020300</td>\n",
       "      <td>0.812145</td>\n",
       "      <td>0.021998</td>\n",
       "      <td>0.8341</td>\n",
       "      <td>0.017061</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.945426</td>\n",
       "      <td>0.033279</td>\n",
       "      <td>0.934755</td>\n",
       "      <td>0.032360</td>\n",
       "      <td>0.937984</td>\n",
       "      <td>0.038656</td>\n",
       "      <td>0.930841</td>\n",
       "      <td>0.040034</td>\n",
       "      <td>0.913784</td>\n",
       "      <td>0.057127</td>\n",
       "      <td>0.937482</td>\n",
       "      <td>0.039889</td>\n",
       "      <td>0.920567</td>\n",
       "      <td>0.044714</td>\n",
       "      <td>0.9204</td>\n",
       "      <td>0.032826</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   ECUBoost-RF  Unnamed: 1  CUBoost-RF  Unnamed: 3  RUSBagging-RF  Unnamed: 5  \\\n",
       "0     0.993103    0.009478    0.989425    0.014841       0.991724    0.011789   \n",
       "1     0.908439    0.044449    0.894431    0.050967       0.886852    0.062806   \n",
       "2     0.993238    0.003612    0.992228    0.004179       0.992723    0.004000   \n",
       "3     0.833268    0.018645    0.821572    0.025394       0.830368    0.017240   \n",
       "4     0.945426    0.033279    0.934755    0.032360       0.937984    0.038656   \n",
       "\n",
       "   RUSBoost-RF  Unnamed: 7   USBC-RF  Unnamed: 9  SMOTE-RF  Unnamed: 11  \\\n",
       "0     0.989425    0.015039  0.985977    0.021724  0.994483     0.007728   \n",
       "1     0.891847    0.058767  0.897006    0.039160  0.913929     0.044064   \n",
       "2     0.993123    0.004163  0.989549    0.005546  0.992334     0.003973   \n",
       "3     0.828618    0.015945  0.831016    0.027691  0.823170     0.020300   \n",
       "4     0.930841    0.040034  0.913784    0.057127  0.937482     0.039889   \n",
       "\n",
       "   EasyEnsemble-RF  Unnamed: 13  XGBoost  Unnamed: 15  \n",
       "0         0.987816     0.021405   0.9956     0.006663  \n",
       "1         0.902778     0.036237   0.8991     0.028219  \n",
       "2         0.991793     0.006411   0.9936     0.003381  \n",
       "3         0.812145     0.021998   0.8341     0.017061  \n",
       "4         0.920567     0.044714   0.9204     0.032826  "
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "datasets=['ecoli_0_vs_1', 'glass1', 'wisconsin', 'pima', 'glass0', 'yeast1', 'haberman', 'vehicle2', 'vehicle1', 'vehicle3', 'vehicle0', 'ecoli1',\n",
    "          'new_thyroid1', 'new_thyroid2', 'ecoli2', 'segment0', 'glass6', 'yeast3', 'ecoli3', 'page_blocks0', 'ecoli-0-3-4_vs_5', 'ecoli-0-2-3-4_vs_5',\n",
    "          'yeast-0-3-5-9_vs_7-8', 'ecoli-0-4-6_vs_5', 'yeast-0-2-5-6_vs_3-7-8-9', 'yeast-0-2-5-7-9_vs_3-6-8', 'ecoli-0-3-4-6_vs_5', 'ecoli-0-3-4-7_vs_5-6',\n",
    "          'ecoli-0-1_vs_2-3-5', 'yeast_2_vs_4', 'ecoli-0-6-7_vs_3-5', 'glass-0-4_vs_5', 'ecoli-0-2-6-7_vs_3-5', 'glass-0-1-5_vs_2', 'yeast_0_5_6_7_9_vs_4',\n",
    "          'vowel0', 'ecoli-0-6-7_vs_5', 'ecoli-0-1-4-7_vs_2-3-5-6', 'glass_0_1_6_vs_2', 'ecoli-0-1_vs_5', 'led7digit-0-2-4-5-6-7-8-9_vs_1', 'glass-0-6_vs_5',\n",
    "          'glass-0-1-4-6_vs_2', 'glass2', 'ecoli-0-1-4-7_vs_5-6', 'cleveland-0_vs_4', 'ecoli-0-1-4-6_vs_5', 'shuttle_c0_vs_c4', 'yeast_1_vs_7', 'ecoli4',\n",
    "          'glass4', 'page_blocks_1_3_vs_4', 'abalone9_18', 'glass_0_1_6_vs_5', 'yeast_1_4_5_8_vs_7', 'yeast_2_vs_8', 'glass5', 'shuttle_c2_vs_c4', 'yeast4',\n",
    "          'yeast_1_2_8_9_vs_7', 'yeast5', 'yeast6', 'ecoli_0_1_3_7_vs_2_6', 'abalone19']\n",
    "df_all = pd.read_excel('total_report_auc.xlsx')\n",
    "df_all.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>datasets</th>\n",
       "      <th>ECUBoost-RF</th>\n",
       "      <th>Unnamed: 1</th>\n",
       "      <th>CUBoost-RF</th>\n",
       "      <th>Unnamed: 3</th>\n",
       "      <th>RUSBagging-RF</th>\n",
       "      <th>Unnamed: 5</th>\n",
       "      <th>RUSBoost-RF</th>\n",
       "      <th>Unnamed: 7</th>\n",
       "      <th>USBC-RF</th>\n",
       "      <th>Unnamed: 9</th>\n",
       "      <th>SMOTE-RF</th>\n",
       "      <th>Unnamed: 11</th>\n",
       "      <th>EasyEnsemble-RF</th>\n",
       "      <th>Unnamed: 13</th>\n",
       "      <th>XGBoost</th>\n",
       "      <th>Unnamed: 15</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>ecoli0vs1 &amp;</td>\n",
       "      <td>$ 99.31 \\pm</td>\n",
       "      <td>0.95 $ &amp;</td>\n",
       "      <td>$ 98.94 \\pm</td>\n",
       "      <td>1.48 $ &amp;</td>\n",
       "      <td>$ 99.17 \\pm</td>\n",
       "      <td>1.18 $ &amp;</td>\n",
       "      <td>$ 98.94 \\pm</td>\n",
       "      <td>1.5 $ &amp;</td>\n",
       "      <td>$ 98.6 \\pm</td>\n",
       "      <td>2.17 $ &amp;</td>\n",
       "      <td>$ 99.45 \\pm</td>\n",
       "      <td>0.77 $ &amp;</td>\n",
       "      <td>$ 98.78 \\pm</td>\n",
       "      <td>2.14 $ &amp;</td>\n",
       "      <td>$ \\bf{99.56 \\pm</td>\n",
       "      <td>0.67} $\\\\</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>glass1 &amp;</td>\n",
       "      <td>$ 90.84 \\pm</td>\n",
       "      <td>4.44 $ &amp;</td>\n",
       "      <td>$ 89.44 \\pm</td>\n",
       "      <td>5.1 $ &amp;</td>\n",
       "      <td>$ 88.69 \\pm</td>\n",
       "      <td>6.28 $ &amp;</td>\n",
       "      <td>$ 89.18 \\pm</td>\n",
       "      <td>5.88 $ &amp;</td>\n",
       "      <td>$ 89.7 \\pm</td>\n",
       "      <td>3.92 $ &amp;</td>\n",
       "      <td>$ \\bf{91.39 \\pm</td>\n",
       "      <td>4.41} $ &amp;</td>\n",
       "      <td>$ 90.28 \\pm</td>\n",
       "      <td>3.62 $ &amp;</td>\n",
       "      <td>$ 89.91 \\pm</td>\n",
       "      <td>2.82 $\\\\</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>wisconsin &amp;</td>\n",
       "      <td>$ 99.32 \\pm</td>\n",
       "      <td>0.36 $ &amp;</td>\n",
       "      <td>$ 99.22 \\pm</td>\n",
       "      <td>0.42 $ &amp;</td>\n",
       "      <td>$ 99.27 \\pm</td>\n",
       "      <td>0.4 $ &amp;</td>\n",
       "      <td>$ 99.31 \\pm</td>\n",
       "      <td>0.42 $ &amp;</td>\n",
       "      <td>$ 98.95 \\pm</td>\n",
       "      <td>0.55 $ &amp;</td>\n",
       "      <td>$ 99.23 \\pm</td>\n",
       "      <td>0.4 $ &amp;</td>\n",
       "      <td>$ 99.18 \\pm</td>\n",
       "      <td>0.64 $ &amp;</td>\n",
       "      <td>$ \\bf{99.36 \\pm</td>\n",
       "      <td>0.34} $\\\\</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>pima &amp;</td>\n",
       "      <td>$ 83.33 \\pm</td>\n",
       "      <td>1.86 $ &amp;</td>\n",
       "      <td>$ 82.16 \\pm</td>\n",
       "      <td>2.54 $ &amp;</td>\n",
       "      <td>$ 83.04 \\pm</td>\n",
       "      <td>1.72 $ &amp;</td>\n",
       "      <td>$ 82.86 \\pm</td>\n",
       "      <td>1.59 $ &amp;</td>\n",
       "      <td>$ 83.1 \\pm</td>\n",
       "      <td>2.77 $ &amp;</td>\n",
       "      <td>$ 82.32 \\pm</td>\n",
       "      <td>2.03 $ &amp;</td>\n",
       "      <td>$ 81.21 \\pm</td>\n",
       "      <td>2.2 $ &amp;</td>\n",
       "      <td>$ \\bf{83.41 \\pm</td>\n",
       "      <td>1.71} $\\\\</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>glass0 &amp;</td>\n",
       "      <td>$ \\bf{94.54 \\pm</td>\n",
       "      <td>3.33} $ &amp;</td>\n",
       "      <td>$ 93.48 \\pm</td>\n",
       "      <td>3.24 $ &amp;</td>\n",
       "      <td>$ 93.8 \\pm</td>\n",
       "      <td>3.87 $ &amp;</td>\n",
       "      <td>$ 93.08 \\pm</td>\n",
       "      <td>4.0 $ &amp;</td>\n",
       "      <td>$ 91.38 \\pm</td>\n",
       "      <td>5.71 $ &amp;</td>\n",
       "      <td>$ 93.75 \\pm</td>\n",
       "      <td>3.99 $ &amp;</td>\n",
       "      <td>$ 92.06 \\pm</td>\n",
       "      <td>4.47 $ &amp;</td>\n",
       "      <td>$ 92.04 \\pm</td>\n",
       "      <td>3.28 $\\\\</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      datasets        ECUBoost-RF Unnamed: 1     CUBoost-RF Unnamed: 3  \\\n",
       "0  ecoli0vs1 &       $ 99.31 \\pm    0.95 $ &   $ 98.94 \\pm    1.48 $ &   \n",
       "1     glass1 &       $ 90.84 \\pm    4.44 $ &   $ 89.44 \\pm     5.1 $ &   \n",
       "2  wisconsin &       $ 99.32 \\pm    0.36 $ &   $ 99.22 \\pm    0.42 $ &   \n",
       "3       pima &       $ 83.33 \\pm    1.86 $ &   $ 82.16 \\pm    2.54 $ &   \n",
       "4     glass0 &   $ \\bf{94.54 \\pm   3.33} $ &   $ 93.48 \\pm    3.24 $ &   \n",
       "\n",
       "   RUSBagging-RF Unnamed: 5    RUSBoost-RF Unnamed: 7        USBC-RF  \\\n",
       "0   $ 99.17 \\pm    1.18 $ &   $ 98.94 \\pm     1.5 $ &    $ 98.6 \\pm    \n",
       "1   $ 88.69 \\pm    6.28 $ &   $ 89.18 \\pm    5.88 $ &    $ 89.7 \\pm    \n",
       "2   $ 99.27 \\pm     0.4 $ &   $ 99.31 \\pm    0.42 $ &   $ 98.95 \\pm    \n",
       "3   $ 83.04 \\pm    1.72 $ &   $ 82.86 \\pm    1.59 $ &    $ 83.1 \\pm    \n",
       "4    $ 93.8 \\pm    3.87 $ &   $ 93.08 \\pm     4.0 $ &   $ 91.38 \\pm    \n",
       "\n",
       "  Unnamed: 9           SMOTE-RF Unnamed: 11 EasyEnsemble-RF Unnamed: 13  \\\n",
       "0   2.17 $ &       $ 99.45 \\pm     0.77 $ &    $ 98.78 \\pm     2.14 $ &   \n",
       "1   3.92 $ &   $ \\bf{91.39 \\pm    4.41} $ &    $ 90.28 \\pm     3.62 $ &   \n",
       "2   0.55 $ &       $ 99.23 \\pm      0.4 $ &    $ 99.18 \\pm     0.64 $ &   \n",
       "3   2.77 $ &       $ 82.32 \\pm     2.03 $ &    $ 81.21 \\pm      2.2 $ &   \n",
       "4   5.71 $ &       $ 93.75 \\pm     3.99 $ &    $ 92.06 \\pm     4.47 $ &   \n",
       "\n",
       "             XGBoost Unnamed: 15  \n",
       "0   $ \\bf{99.56 \\pm    0.67} $\\\\  \n",
       "1       $ 89.91 \\pm     2.82 $\\\\  \n",
       "2   $ \\bf{99.36 \\pm    0.34} $\\\\  \n",
       "3   $ \\bf{83.41 \\pm    1.71} $\\\\  \n",
       "4       $ 92.04 \\pm     3.28 $\\\\  "
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# preprocess\n",
    "datasets = [d.replace('_','').replace('-','') for d in datasets]\n",
    "df_all=df_all*100\n",
    "df_all.insert(0,'datasets',datasets)\n",
    "max_scores = []\n",
    "import numpy as np\n",
    "for i in range(df_all.shape[1]):\n",
    "    if i!=0:\n",
    "        df_all.iloc[:,i]=np.round(df_all.iloc[:,i].values,2)\n",
    "\n",
    "for i in range(df_all.shape[0]):\n",
    "    scores = df_all.iloc[i,1:].values\n",
    "    scores=scores[np.arange(0,df_all.shape[1]-1,2)]\n",
    "    max_scores.append(max(scores))\n",
    "\n",
    "df_all = pd.DataFrame(df_all,dtype=str)\n",
    "for i in range(df_all.shape[0]):\n",
    "    for j in range(1, df_all.shape[1], 2):\n",
    "        if float(df_all.iloc[i,j])==max_scores[i]:\n",
    "            df_all.iloc[i,j]='\\\\bf{'+df_all.iloc[i,j]\n",
    "            df_all.iloc[i,j+1]=df_all.iloc[i,j+1]+'}'\n",
    "        \n",
    "for i in range(df_all.shape[1]):\n",
    "    if i==0:\n",
    "        df_all.iloc[:,i]=df_all.iloc[:,i]+' &'\n",
    "    else:\n",
    "        if i%2==1:\n",
    "            df_all.iloc[:,i]=' $ '+df_all.iloc[:,i]+' \\pm '\n",
    "        else:\n",
    "            if i==df_all.shape[1]-1:\n",
    "                df_all.iloc[:,i]+=' $\\\\\\\\'\n",
    "            else:\n",
    "                df_all.iloc[:,i]+=' $ &'\n",
    "    \n",
    "df_all.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df_all.to_csv('auc_latex.csv',index=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
